import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.math.BigDecimal;
import java.math.RoundingMode;

import static java.lang.Integer.parseInt;


/**
 * @author Anna Alexeyenko
 *         Time: 5:36 PM
 */
public class ATM {

    private static final double COMMISSION_CENTS = 50;
    private static final char DOT = ".".charAt(0);
    private static int dollar;
    private static int cents;

    public static void main(String args[]) {
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        try {
            String input = in.readLine();
            String[] split = input.split(" ");
            int sum = parseInt(split[0]);
            char[] balance = split[1].toCharArray();

            System.out.println(tryToWithdrow(sum, getBalanceInCents(balance)));
        } catch (Exception ex) {
            System.out.print(ex.getMessage());
        }
    }

    static int getBalanceInCents(char[] balance) {
        String s = new String(balance);
        for (int i = 0; i < balance.length; i++) {
            if (balance[i] == DOT) {
                dollar = parseInt(s.substring(0, i));
                cents = parseInt(s.substring(i + 1));
                if (s.substring(i + 1).length() == 1) {
                    cents *= 10;
                }
                return dollar * 100 + cents;
            }
        }
        return parseInt(s) * 100;
    }

    static double tryToWithdrow(int sum, int balanceInCents) {
        if ((sum % 5 == 0) && (sum <= ((balanceInCents - COMMISSION_CENTS) / 100)) && (sum > 0)) {
            double newBalance = ((balanceInCents - COMMISSION_CENTS) / 100) - sum;

            return new BigDecimal(newBalance).setScale(2, RoundingMode.HALF_UP).doubleValue();
        }
        return new BigDecimal((double) balanceInCents / 100).setScale(2, RoundingMode.HALF_UP).doubleValue();

    }
}
